package com.cn.sender.callback;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * 消息投递有没到达目标queue，会回调这个接口，这个时候可以做持久化，
 */
@Slf4j
@Component
public class ReturnCallbackService implements RabbitTemplate.ReturnsCallback{
    @Override
    public void returnedMessage(ReturnedMessage returnedMessage) {
        log.info("returnedMessage:{}",returnedMessage.toString());
    }
}
